package com.at.lmm.consumer;

import com.at.lmm.entiy.UserInfo;
import com.at.lmm.service.UserService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConsumerController {
    @DubboReference(protocol = "dubbo", loadbalance = "random")
    private UserService userService;

    @GetMapping("/userInfo/{userId}")
    public UserInfo getUserInfo(@PathVariable("userId") Long userId){
        return userService.getUserById(userId);
    }

    @GetMapping("/test")
    public String test(){
        return "test";
    }
}
